home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / 4D.vu next >
Encoding:
Text File  |  1993-12-17  |  12.5 KB  |  345 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        4D.vu
  5. #
  6. #    Contains:    Quick look test script for 4th Dimension version 2.2.3
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.6>     9/20/93    KTA        Redefine gCustomRetrievedDoc to incorporate teh wildcard
  19. #                                    character.
  20. #     <1.0.5>     9/14/93    KTA        Define gCustomRetrievedDoc prior to calling SaveAs().
  21. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)()to InitGlobals(ScriptLevel)()
  22. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  23. #
  24. # ****************************************************************************
  25. #
  26.  
  27.  
  28.  
  29. ########################################################################
  30. #                            External libraries 
  31. #=======================================================================
  32. Libraries "Output.Lib", "DoTasks.Lib","UserInterface.Lib","Draw.Lib", "StandardFile.Lib", "Da.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  33.  
  34.  
  35. #########################################################################
  36. ########               Application Specific Tasks
  37. #########################################################################
  38.  
  39. #########################################################################
  40. #                        InitAppGlobals()
  41. #========================================================================
  42. # Author:        ML
  43. # Description:    Sets up the tool palette for 4D.  This task
  44. #                must be called first.
  45. # Parameters:    None
  46. # Returns:        Nothing
  47. # Examples:        InitAppGlobals()
  48. #========================================================================
  49. # History:
  50. #
  51. ########################################################################
  52. task InitAppGlobals()
  53. begin
  54.     global gApptitle;
  55.     logstr("setting up {gApptitle}'s tool globals");            
  56.     global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
  57.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  58.     global kDrawPaletteNum := 1; 
  59.     
  60.     global gPaletteList :=    {
  61.                             {                        #### Start Palette #1 - Draw
  62.                             {0,20,44,260,0},        # Location of tab palette relative to the window
  63.                             kPalDocWind,            # Palette type
  64.                             {2,11},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  65.                             {22,22},                # Offset between tools {h,v}
  66.                             0,                        # Not used at this time
  67.                             0                        # Not used at this time
  68.                             }                        #### End Palette #1
  69.     };
  70.  
  71.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  72.     global LineTool :=             { 1,      1,        "Line",            kDrag,    0,                {0}                };
  73.     global SelectTool :=         { 2,      1,        "Select",        kClick,    0,                {0}                };
  74.     global CircleTool :=         { 3,     1,        "Circle",        kDrag,     0,                {0}                };
  75.     global TextTool :=             { 4,      1,        "Text",            kDrag,    0,                {0}                };
  76.     global RoundRectTool :=        { 5,      1,        "Round Rect",    kDrag,    0,                {0}                };
  77.     global RectangleTool :=     { 6,     1,        "Rectangle",    kDrag,    0,                {0}                };
  78.     global AlignRightTool :=     { 11,      1,        "Align Right",    0,         0,                {0}                };
  79.     global AlignLeftTool :=     { 12,      1,        "Align Left",    0,         0,                {0}                };
  80.     global AlignVCenterTool :=     { 13,      1,        "Align V. Center",    0,     0,                {0}                };
  81.     global AlignHCenterTool :=     { 14,      1,        "Align H. Center",    0,     0,                {0}                };
  82.     global AlignBottomTool :=     { 15,      1,        "Align Bottom",        0,     0,                {0}                };
  83.     global AlignTopTool :=         { 16,      1,        "Align Top",        0,     0,                {0}                };
  84.     global SendToFrontTool :=     { 17,      1,        "Send To Front",    0,    0,                {0}                };
  85.     global SendToBackTool :=     { 18,      1,        "Send To Back",        0,    0,                {0}                };
  86.     
  87.     global DrawToolList:={    LineTool,
  88.                             SelectTool,
  89.                             CircleTool,
  90.                             TextTool,
  91.                             RoundRectTool,
  92.                             RectangleTool,
  93.                             AlignRightTool,
  94.                             AlignLeftTool,
  95.                             AlignVCenterTool,
  96.                             AlignHCenterTool,
  97.                             AlignBottomTool,
  98.                             AlignTopTool,
  99.                             SendToFrontTool,
  100.                             SendToBackTool
  101.                         };
  102.  
  103.     global gToolList:= DrawToolList;
  104.     
  105.         ### Set DoWindows to skip scrolling, scroll bars not recognized
  106.     global gDoWindowList:= {1,0,1,1};
  107.  
  108.     logstr("setting up {gApptitle}'s's font globals");
  109.     
  110.         ### font characteristic lists
  111.     global gFontSizeList := {'9','10','12','14','18','24','36'};
  112.     global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow'};
  113.  
  114.         ### Name of the Plain (style) menu item  ####
  115.     global gPlainStyle := "Plain";            # Plain-Style menu item
  116.  
  117.         ### How to get to the next line
  118.     global gNextLineMethod := 1;            
  119.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  120.     
  121.         ### Does moving to the next line clear all font info
  122.     global gNextLineClearsFontSettings := 0;
  123.     global gNumRandomFontTests := 1; # only one iteration since we draw only
  124.                                      # one text block
  125.                                                                           
  126. end;    #InitAppGlobals
  127.  
  128. #########################################################################
  129. #                            NewField()
  130. #========================================================================
  131. # Author:        JLM (x45604)
  132. # Description:    Inserts new fields into database file
  133. # Parameters:    Nothing
  134. # Returns:        Nothing
  135. # Examples:        NewField();
  136. # Assumptions:    None 
  137. # Applications:        4th Dimension
  138. #========================================================================
  139. # History:
  140. #
  141. #########################################################################
  142. task NewField(FieldName) begin
  143.     logstr("Creating a new field called '{FieldName}'");
  144.     selectMenuItem("New Field", "Structure");
  145.     x := match [button t:'OK']!;
  146.     if x begin
  147.         TypeStr(FieldName);
  148.         selectButton('OK');
  149.     end;
  150.     else begin
  151.         LogStr("!@#$%    No Save Button ");
  152.     end;
  153. end;
  154.  
  155.  
  156. #########################################################################
  157. #                            NewLayout()
  158. #========================================================================
  159. # Author:        KTA (x45604)
  160. # Description:    Sets up a new Layout
  161. # Parameters:    Nothing
  162. # Returns:        Nothing
  163. # Examples:        NewLayout();
  164. # Assumptions:    None 
  165. # Applications:        4th Dimension
  166. #========================================================================
  167. # History:
  168. #
  169. #########################################################################
  170. task NewLayout()
  171. begin
  172.     selectMenuItem("Layout", "Design");                #create layout
  173.     selectButton('New');            
  174.     TypeStr("ShimmaLayout");
  175.     selectButton('OK');
  176.     LogStr("Created new layout",3);
  177. end;
  178.  
  179. #########################################################################
  180. #                            EnterRecord()
  181. #========================================================================
  182. # Author:        KTA (x45604)
  183. # Description:    Enters Records
  184. # Parameters:    Nothing
  185. # Returns:        Nothing
  186. # Examples:        EnterRecord();
  187. # Assumptions:    None 
  188. # Applications:        4th Dimension
  189. #========================================================================
  190. # History:
  191. #
  192. #########################################################################
  193. task EnterRecord()
  194. begin
  195.     selectMenuItem("New Record", "Enter");
  196.     DataList1 := {'Freehand','Wingz','PageMaker'};
  197.     DataList2 := {'Studio8','Excel','X-Quark'};
  198.     DataListControl :={DataList1, DataList2};
  199.     For each DataList in DataListControl
  200.     begin
  201.         TypeList(DataList,1,1);
  202.     
  203.         selectMenuItem("New Record", "Enter");
  204.         SpecialKey(returnKey, 'Return Key');    #To Select the Default-Save 
  205.     end;
  206.     
  207.     LogStr("Entered two new records",3);
  208. end;
  209.  
  210. #########################################################################
  211. #                            NewDataStructure()
  212. #========================================================================
  213. # Author:        KTA (x45604)
  214. # Description:    Sets up new Database structure
  215. # Parameters:    Nothing
  216. # Returns:        Nothing
  217. # Examples:        NewDataStructure(1);
  218. # Assumptions:    None 
  219. # Applications:        4th Dimension
  220. #========================================================================
  221. # History:
  222. #
  223. #########################################################################
  224. task NewDataStructure()
  225. begin
  226.  
  227.     LogStr("Creating a new database structure",3);
  228.     selectMenuItem("Rename File", "Structure");    # Rename file to Software
  229.     TypeStr("Software");
  230.         SpecialKey(returnKey, 'Return Key');
  231.     wait(2);
  232.     NewField("Graphics");                        # Enter fields into file
  233.     NewField("Spreadsheets");
  234.     NewField("DTP");
  235. end;    
  236.  
  237. #########################################################################
  238. #                            4DScroll()
  239. #========================================================================
  240. # Author:        ML
  241. # Description:    Scroll vertically and horizontally, and return
  242. # Parameters:    None
  243. # Returns:        Nothing
  244. # Examples:        FourDScroll();
  245. # Assumptions:    None 
  246. # Applications:    4D
  247. #========================================================================
  248. # History:
  249. #
  250. #########################################################################
  251. task FourDScroll()
  252. begin
  253.     match[window o:1 s:document c:true z:true g:true r:?ScreenDim];
  254.     WindowRight:= ScreenDim[3];
  255.     WindowBottom:= ScreenDim[4];
  256.     HRightScrollButton:= (WindowRight-10);
  257.     VRightScrollButtonBegin:= 65;
  258.     VRightScrollButtonEnd:= (WindowBottom-40);
  259.     VBottomScrollButton:= (WindowBottom-10);
  260.     HBottomScrollButtonBegin:= 39;
  261.     HBottomScrollButtonEnd:= WindowRight-40;
  262.     
  263.     LogStr("Scroll the window vertically using absolute coordinates");
  264.     MoveMouse(HRightScrollButton,VRightScrollButtonBegin);
  265.     MoveMouse(HRightScrollButton,VRightScrollButtonEnd,,1);
  266.     
  267.     LogStr("Scroll the window horizontally using absolute coordinates");
  268.     MoveMouse(HBottomScrollButtonBegin,VBottomScrollButton);
  269.     MoveMouse(HBottomScrollButtonEnd,VBottomScrollButton,,1);
  270.     
  271.     LogStr("Scroll back to original vertical position");
  272.     MoveMouse(HRightScrollButton,VRightScrollButtonEnd);
  273.     MoveMouse(HRightScrollButton,VRightScrollButtonBegin,,1);
  274.     
  275.     LogStr("Scroll back to original horizontal position");
  276.     MoveMouse(HBottomScrollButtonEnd,VBottomScrollButton);
  277.     MoveMouse(HBottomScrollButtonBegin,VBottomScrollButton,,1);
  278. end;
  279.  
  280. ################################################################################
  281. ####################             Main script                    ####################
  282. ################################################################################
  283. script FourD (ScriptLevel:= -1)
  284. begin
  285.     InitGlobals(ScriptLevel);
  286.     InitDraw();
  287.     InitFonts();
  288.     global gAppTitle := '4th DIMENSION';            # Don't use full name because it makes
  289.     global gAppVersion := '2';                        # gFileName too long for Standard File
  290.     SuiteStart('4D.vu');                            # begin a new test suite
  291.     if LaunchTwitch("{gAppTitle}",gAliasDirectory)    # launch or twitch to your app
  292.     begin
  293.         global gFileName := "@!@-{gBuildVers}-'4th DIM'"; # This is used in NameOK when saving files
  294.         # gAppTitle not used because it makes gFileName too long for Standard File
  295.         InitAppGlobals();                            # Can't use tools - see note below
  296.         (*
  297.         *)
  298.         DoSetUpApp(,-1,0,'New',,,0);                # select "New" at launch
  299.         
  300.         global gCustomRetrievedDoc := [window t:/Structure for≈/ o:1 s:document c:false z:true g:true];                                 
  301.         
  302.         SaveAs(gFileName,0);                        # name database
  303.                 
  304.         NewDataStructure();                            # Sets up new Database structure
  305.         
  306.         OpenFile(global gLastSavedFile,,{global gLastSavedFile},1);            # open folder first time
  307.         
  308.         NewLayout();                                # New Layout
  309.         
  310.         Scrapbook(global kScrapPICT);                # Paste a Graphic from Scrapbook
  311.         
  312.         SelectMenuItem ('Save Layout','File');        # save layout
  313.         
  314.         DoWindow();                                    # test windows
  315.         
  316.         FourDScroll();                                # ScrollWindow() doesn't work in 4D
  317.         Scrapbook(global kScrapPICT);                # Paste a Graphic from Scrapbook
  318.         
  319.         Revert();                                    # gets rid of second scrap pict
  320.         
  321.         CloseWindow();                                   # Test the Close box
  322.         
  323.         selectMenuItem("User", "Use");                # Change to user mode
  324.         wait(4);
  325.         EnterRecord();                                # enter some data
  326.         
  327.         selectMenuItem("Design", "Use");            # Back to 'Design' mode
  328.         selectButton("Don't Save");            
  329.             
  330.         selectMenuItem("New File", "Structure");    # Create new  file
  331.         moveRelativeToWindow(200,100,1,2);            # Select place for new file
  332.         LogStr("Created a new file",3);
  333.         
  334.         DoCloseApp(-1);
  335.         
  336.         LogStr("############################# LIMITATIONS: ############################");
  337.         LogStr("NOTE: Do to unique nature of 4D, many standard QL tests can't be done.");
  338.         LogStr('NOTE: Different modes are equivelant to Views() in 4D',2);
  339.         LogStr("NOTE: Can't paste Text from scrapbook in Layout mode without using text tool",2);
  340.         LogStr('NOTE: No DoDraw because 4D disables VU mousedown on tool palette',2);
  341.         LogStr('NOTE: No DoText because individual text boxes must be drawn',2);
  342.         LogStr('NOTE: No Save As... menuitems in 4D',2);
  343.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  344.     SuiteEnd();
  345. end; # script FourD